<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/27
 * Time: 9:21
 */

namespace common\business\kingdee;


use common\business\DbHandler;
use common\models\kingdee\OrgAdmin;
use common\result\ActionResult;

class OrgAdminApiHandler extends DbHandler
{
    /**
     * @param $obj OrgAdmin
     * @return ActionResult
     */
    public function createOrgAdmin($obj){
        return $this->create($obj);
    }

    /**
     * @param OrgAdmin $newObj
     * @param OrgAdmin $oldObj
     * @return ActionResult
     */
    public function updateOrgAdmin($newObj, $oldObj = null){
        if (!$oldObj){
            $oldObj = OrgAdmin::findOne([
                'FID' => $newObj->FID,
            ]);
        }
        return $this->update($newObj, $oldObj, [
            'FNAME_L2',
            'FISJURIDICALCOMPANY',
            'FJURIDICALPERSONID',
            'FRESERVEFIELDSECOND',
            'FEFFDT',
            'FLEFFDT',
            'FADMINADDRESS_L2',
            'FZIPCODE',
            'FPHONENUMBER',
            'FCODE',
        ]);
    }

    /**
     * @param $obj OrgAdmin
     * @return ActionResult
     */
    public function deleteOrgAdmin($obj){
        return $this->delete($obj);
    }
}